#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int n, m;
struct people
{
	int id;
	int score;
}stc[5005];
int compare(const void* p1, const void* p2)
{
	if (((struct people*)p1)->score > ((struct people*)p2)->score)
		return -1;
	else if (((struct people*)p1)->score < ((struct people*)p2)->score)
		return 1;
	else {
		if (((struct people*)p1)->id > ((struct people*)p2)->id)
			return 1;
		else
			return -1;
	}
}
int main()
{
	int i = 0, j = 0;
	int need = 0;
	int end_score = 0;
	int end_peo = 0;
	cin >> n >> m;
	need = 1.5 * m;
	for (i = 0; i < n; i++) {
		scanf("%d%d", &stc[i].id, &stc[i].score);
	}
	qsort(stc, n, sizeof(struct people), compare);
	end_score = stc[need - 1].score;
	end_peo = need;
	while (end_peo <= n && stc[end_peo].score == end_score)
		end_peo++;
	cout << end_score << " " << end_peo << endl;
	for (i = 0; i < end_peo; i++)
		printf("%d %d\n", stc[i].id, stc[i].score);
	return 0;
}